<template>
  <div class="menu">
    <el-menu
      router
      :default-active="$route.path"
      background-color="#324157"
      text-color="#fff"
      active-text-color="#fff"
      unique-opened
    >
      <el-menu-item index="/home">
        <i class="el-icon-menu" style="color: #fff"></i>
        <span style="margin-left:6px;">首页</span>
      </el-menu-item>
      <el-submenu v-for="item in menu" :index="item.id" :key="item.id">
        <template slot="title">
          <i :class="item.icon" style="color: #fff"></i>
          {{ item.name }}
        </template>
        <el-menu-item-group
          v-for="(items, indexs) in item.submenu"
          :key="indexs"
        >
          <el-menu-item :index="items.to" style="margin-top: -16px;">
              <span style="margin-left:10px;">{{ items.name }}</span>
          </el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
  </div>
</template>
<script>
import menu from "../../config/menu";
export default {
  name: "NavMenu",
  data() {
    return {
      menu: menu,
    };
  },
};
</script>
<style scoped>
.el-menu {
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}
.el-menu-item.is-active {
      background-color: #3370ff !important;
      color: #fff;
    }
::-webkit-scrollbar {
  display: none;
}
</style>